package com.skynet.backend.auth.sys.controller;

import com.skynet.backend.auth.common.util.ResultVOUtil;
import com.skynet.backend.auth.sys.vo.SysMenuItemVoFactory;
import com.skynet.backend.auth.sys.entity.SysMenuEntity;
import com.skynet.backend.auth.sys.service.SysMenuService;
import com.skynet.backend.auth.sys.vo.ResultVO;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Skynet
 * @date 2018年02月27日 13:05
 */
@RestController
@RequestMapping("/sys/menu")
@Api(value="用户信息")
public class SysMenuController {

    @Autowired
    private SysMenuService sysMenuService;

    /**
     * 导航栏菜单
     * @return 返回导航栏
     */
    @GetMapping("/nav")
    @ApiOperation(value="获取用户菜单列表")
    public ResultVO nav(){
        List<SysMenuEntity> userMenuList = sysMenuService.getUserMenuList(2L);
        return ResultVOUtil.success(SysMenuItemVoFactory.mapToSysMenuItem(userMenuList));
    }



}
